]> andersk Git - moira.git/blame - clients/moira/delete.c
Change `SMS' to `Moira' where possible.
[moira.git] / clients / moira / delete.c
CommitLineData
402461ad 1#if (!defined(lint) && !defined(SABER))
08345b74 2 static char rcsid_module_c[] = "$Header$";
7798ebc3 3#endif
08345b74 4
59ec8dae 5/* This is the file delete.c for the Moira Client, which allows users
6 * to quickly and easily maintain most parts of the Moira database.
08345b74 7 * It Contains: functions for deleting users and lists.
5eaef520 8 *
08345b74 9 * Created: 5/18/88
10 * By: Chris D. Peterson
11 *
12 * $Source$
13 * $Author$
14 * $Header$
5eaef520 15 *
0a2c64cb 16 * Copyright 1988 by the Massachusetts Institute of Technology.
08345b74 17 *
5eaef520 18 * For further information on copyright and distribution
08345b74 19 * see the file mit-copyright.h
20 */
21
08345b74 22#include <stdio.h>
24419c79 23#include <string.h>
8defc06b 24#include <moira.h>
25#include <moira_site.h>
08345b74 26#include <menu.h>
27
461c03b6 28#include "mit-copyright.h"
0a2c64cb 29#include "defs.h"
30#include "f_defs.h"
461c03b6 31#include "globals.h"
461c03b6 32
08345b74 33/* Function Name: CheckListForDeletion
34 * Description: Check one of the lists in which we just removed a member.
35 * if the list is empty then it will delete it.
36 * Arguments: name - name of the list to check.
37 * verbose - verbose mode?
38 * Returns: none.
39 */
40
5eaef520 41int CheckListForDeletion(char *name, Bool verbose)
08345b74 42{
5eaef520 43 struct qelem *elem = NULL;
44 int status;
45 char *args[2], buf[BUFSIZ], **info;
46
47 if ((status = do_mr_query("count_members_of_list", 1, &name, StoreInfo,
48 (char *) &elem)))
49 {
50 com_err(program_name, status, " in DeleteList (count_members_of_list).");
51 return SUB_NORMAL;
08345b74 52 }
5eaef520 53 info = (char **) elem->q_data;
54 if (!strcmp(info[NAME], "0"))
55 {
56 if (verbose)
57 {
58 sprintf(buf, "Delete the empty list %s? ", name);
59 switch (YesNoQuestion(buf, FALSE))
60 {
225ce369 61 case TRUE:
5eaef520 62 break;
225ce369 63 case FALSE:
5eaef520 64 Put_message("Not deleting this list.");
65 FreeQueue(elem);
66 return SUB_NORMAL;
225ce369 67 default:
5eaef520 68 Put_message("Aborting Deletion!");
69 FreeQueue(elem);
70 return SUB_ERROR;
461c03b6 71 }
08345b74 72 }
5eaef520 73 args[0] = "foo"; /* not used. */
74 args[1] = name;
75 DeleteList(2, args);
08345b74 76 }
5eaef520 77 FreeQueue(elem);
78 return SUB_NORMAL;
08345b74 79}
80
075fe5bb 81/* Function Name: CheckAce
82 * Description: Checks an ace to see of we should delete it.
83 * Arguments: type - the type of this ace.
84 * name - the name of the ace.
08345b74 85 * verbose - query user?
86 * Returns: none.
87 */
88
5eaef520 89void CheckAce(char *type, char *name, Bool verbose)
08345b74 90{
5eaef520 91 char *args[2], buf[BUFSIZ];
92 int status;
93
94 if (strcmp(type, "LIST"))
95 return; /* If the ace is not a list the ignore it. */
96
97 args[0] = type;
98 args[1] = name;
99 status = do_mr_query("get_ace_use", 2, args, NullFunc, NULL);
100 if (status != MR_NO_MATCH)
101 return; /* If this query fails the ace will
461c03b6 102 not be deleted even if it is empty. */
5eaef520 103 if (verbose)
104 {
105 sprintf(buf, "Delete the unused Access Control Entity (ACE) %s? ", name);
106 if (YesNoQuestion(buf, FALSE) != TRUE)
107 {
108 Put_message("Aborting Deletion!");
109 return;
461c03b6 110 }
08345b74 111 }
5eaef520 112 /*
113 * Delete the ACE.
114 *
115 * NOTE: Delete list expects only the name of the list to delete in argv[1].
116 * since, 'args' already satisfies this, there is no need to create
117 * a special argument list.
118 */
119 DeleteList(2, args);
08345b74 120}
5eaef520 121
08345b74 122
075fe5bb 123/* Function Name: CheckIfAce
124 * Description: Checks to see if this is an ace of another data object.
08345b74 125 * Arguments: name - name of the object.
253517e2 126 * Returns: SUB_ERROR if this list is an ace, or if the query did not
08345b74 127 * succeed.
128 */
129
5eaef520 130int CheckIfAce(char *name, char *type, Bool verbose)
08345b74 131{
5eaef520 132 char *args[2], buf[BUFSIZ], **info;
133 struct qelem *local, *elem;
134 int status;
135 elem = NULL;
136
137 args[0] = type;
138 args[1] = name;
139 switch ((status = do_mr_query("get_ace_use", 2, args,
140 StoreInfo, (char *) &elem)))
141 {
8defc06b 142 case MR_NO_MATCH:
5eaef520 143 return DM_NORMAL;
8defc06b 144 case MR_SUCCESS:
5eaef520 145 local = elem = QueueTop(elem);
146 info = (char **) local->q_data;
147 if (QueueCount(elem) == 1 &&
148 !strcmp(info[0], "LIST") &&
149 !strcmp(info[1], name))
150 {
151 FreeQueue(elem);
152 return DM_NORMAL;
253517e2 153 }
5eaef520 154 if (verbose)
155 {
156 sprintf(buf, "%s %s %s", type, name,
157 "is the ACE for the following data objects:");
158 Put_message(buf);
159 Put_message("");
160 for (; local != NULL; local = local->q_forw)
161 {
162 info = (char **) local->q_data;
163 if (!strcmp(info[0], "LIST") &&
164 !strcmp(info[1], name))
165 continue;
166 Print(CountArgs(info), info, NULL);
075fe5bb 167 }
5eaef520 168 Put_message("");
169 Put_message("The ACE for each of these items must be changed before");
170 sprintf(buf, "the %s %s can be deleted.\n", type, name);
171 Put_message(buf);
08345b74 172 }
5eaef520 173 break;
075fe5bb 174 default:
5eaef520 175 com_err(program_name, status, " in CheckIfAce (get_ace_use).");
176 return SUB_ERROR;
08345b74 177 }
5eaef520 178 FreeQueue(elem);
179 return SUB_ERROR;
08345b74 180}
181
8429393f 182/* Function Name: RemoveItemFromLists
183 * Description: this function removes a list from all other lists of
08345b74 184 * which it is a member.
8429393f 185 * Arguments: name - name of the item
186 * elem - a pointer to a queue element. RETURNED
08345b74 187 * verbose - verbose mode.
8429393f 188 * Returns: SUB_ERROR if there is an error.
08345b74 189 */
190
5eaef520 191int RemoveItemFromLists(char *name, char *type, struct qelem **elem,
192 int verbose)
08345b74 193{
5eaef520 194 struct qelem *local;
195 char *args[10], temp_buf[BUFSIZ];
196 int lists;
44d12d58 197 int status;
08345b74 198
5eaef520 199 args[0] = type;
200 args[1] = name;
201 *elem = NULL;
08345b74 202
5eaef520 203 /*
204 * Get all list of which this item is a member, and store them in a queue.
205 */
08345b74 206
5eaef520 207 status = do_mr_query("get_lists_of_member", 2, args, StoreInfo,
208 (char *) elem);
08345b74 209
5eaef520 210 if (status == MR_NO_MATCH)
211 return SUB_NORMAL;
212
213 if (status != MR_SUCCESS)
214 {
215 com_err(program_name, status, " in DeleteList (get_lists_of_member).");
216 return SUB_ERROR;
217 }
08345b74 218
5eaef520 219 /*
220 * If verbose mode, ask user of we should remove our list from
221 * all these lists.
222 */
223
224 local = *elem = QueueTop(*elem);
225 lists = QueueCount(*elem);
226 if (lists == 0)
227 return SUB_NORMAL;
228 if (verbose)
229 {
230 sprintf(temp_buf, "%s %s is a member of %d other list%s.\n", type,
231 name, lists, ((lists == 1) ? "" : "s"));
232 Put_message(temp_buf);
233 while (local)
234 {
235 char **info = (char **) local->q_data;
236 Print(1, &info[GLOM_NAME], (char *) NULL);
08345b74 237 local = local->q_forw;
238 }
8429393f 239 Put_message(" "); /* Blank Line. */
5eaef520 240 sprintf(temp_buf, "Remove %s %s from these lists? ", type, name);
241 if (YesNoQuestion(temp_buf, FALSE) != TRUE)
242 {
8429393f 243 Put_message("Aborting...");
244 FreeQueue(*elem);
245 *elem = NULL;
5eaef520 246 return SUB_ERROR;
247 }
08345b74 248 }
249
5eaef520 250 /*
251 * Remove this list from all lists that it is a member of.
252 */
253
254 local = *elem;
255 args[DM_MEMBER] = name;
256 args[DM_TYPE] = type;
257 while (local)
258 {
259 char **info = (char **) local->q_data;
260 args[DM_LIST] = info[GLOM_NAME];
261 if ((status = do_mr_query("delete_member_from_list",
262 3, args, Scream, NULL)))
263 {
264 com_err(program_name, status, " in delete_member\nAborting\n");
265 FreeQueue(*elem);
266 return SUB_ERROR;
08345b74 267 }
5eaef520 268 local = local->q_forw;
08345b74 269 }
5eaef520 270 return SUB_NORMAL;
08345b74 271}
272
8429393f 273/* Function Name: RemoveMembersOfList
274 * Description: Deletes the members of the list.
275 * Arguments: name - name of the list.
08345b74 276 * verbose - query user, about deletion?
8429393f 277 * Returns: SUB_ERROR - if we could not delete, or the user abouted.
08345b74 278 */
279
5eaef520 280int RemoveMembersOfList(char *name, Bool verbose)
08345b74 281{
5eaef520 282 char buf[BUFSIZ], *args[10];
283 struct qelem *local, *elem = NULL;
284 int status, members;
285 /*
286 * Get the members of this list.
287 */
288 status = do_mr_query("get_members_of_list", 1, &name, StoreInfo,
289 (char *) &elem);
290 if (status == MR_NO_MATCH)
291 return SUB_NORMAL;
292
293 if (status)
294 {
295 com_err(program_name, status, " in DeleteList (get_members_of_list).");
296 return SUB_ERROR;
08345b74 297 }
5eaef520 298 /*
299 * If verbose mode, then ask the user if we should delete.
300 */
301 local = elem = QueueTop(elem);
302 if (!(members = QueueCount(elem)))
303 return SUB_NORMAL;
304 if (verbose)
305 {
306 sprintf(buf, "List %s has %d member%s:", name, QueueCount(elem),
307 ((members == 1) ? "" : "s"));
308 Put_message(buf);
309 Put_message(" "); /* Blank Line. */
310 while (local)
311 {
312 char **info = (char **) local->q_data;
313 Print(CountArgs(info), info, NULL);
314 local = local->q_forw;
08345b74 315 }
5eaef520 316 Put_message(" "); /* Blank Line. */
317 sprintf(buf, "Remove th%s member%s from list %s? ",
318 ((members == 1) ? "is" : "ese"),
319 ((members == 1) ? "" : "s"), name);
320 if (YesNoQuestion(buf, FALSE) != TRUE)
321 {
322 Put_message("Aborting...");
323 FreeQueue(elem);
324 return SUB_ERROR;
08345b74 325 }
326 }
5eaef520 327 /*
328 * Perform The Removal.
329 */
330 local = elem;
331 args[0] = name;
332 while (local)
333 {
334 char **info = (char **) local->q_data;
335 args[1] = info[0];
336 args[2] = info[1];
337 if ((status = do_mr_query("delete_member_from_list",
338 3, args, Scream, NULL)))
339 {
340 com_err(program_name, status, " in delete_member\nAborting\n");
341 FreeQueue(elem);
342 return SUB_ERROR;
08345b74 343 }
5eaef520 344 local = local->q_forw;
08345b74 345 }
5eaef520 346 return SUB_NORMAL;
08345b74 347}
348
8429393f 349/* Function Name: DeleteUserGroup
350 * Description: Deletes the list given by name if it exists.
08345b74 351 * intended to be used to delete user groups
352 * Arguments: name - the name of the list to delete.
353 * verbose - flag that if TRUE queries the user to
354 * ask if list should be deleted.
8defc06b 355 * Returns: MR_ERROR if there is an error.
08345b74 356 */
357
5eaef520 358int DeleteUserGroup(char *name, Bool verbose)
08345b74 359{
5eaef520 360 int status, ans;
361 char buf[BUFSIZ], *args[10];
362
363 status = do_mr_query("get_list_info", 1, &name, NullFunc, (char *) NULL);
364 if (!status)
365 {
366 if (verbose)
367 {
368 sprintf(buf, "There is also a list named %s, delete it?", name);
369 ans = YesNoQuestion(buf, FALSE);
370 if (ans == FALSE)
371 {
372 Put_message("Leaving group alone.");
373 return SUB_NORMAL;
08345b74 374 }
5eaef520 375 if (ans < 0)
376 {
377 Put_message("Aborting...\n");
378 return SUB_ERROR;
08345b74 379 }
380 }
5eaef520 381 /* ans == TRUE || ~verbose */
382 args[0] = "foo"; /* not used. */
383 args[1] = name;
384 DeleteList(2, args);
08345b74 385 }
5eaef520 386 else if (status != MR_NO_MATCH)
387 {
388 com_err(program_name, status, " Aborting Delete User.");
389 return SUB_ERROR;
08345b74 390 }
5eaef520 391 return SUB_NORMAL;
08345b74 392}
393
394/* Function Name: DeleteHomeFilesys
395 * Description: Delete the home filesystem for the named user.
396 * Arguments: name - name of the user (and filsystem) to delete.
397 * verbose - if TRUE query user.
398 * Returns: SUB_NORMAL if home filesystem deleted, or nonexistant.
399 */
400
5eaef520 401int DeleteHomeFilesys(char *name, Bool verbose)
08345b74 402{
5eaef520 403 int status;
404 char buf[BUFSIZ];
405
406 switch ((status = do_mr_query("get_filesys_by_label", 1, &name, NullFunc,
407 NULL)))
408 {
8defc06b 409 case MR_NO_MATCH:
5eaef520 410 break;
8defc06b 411 case MR_SUCCESS:
5eaef520 412 if (verbose)
413 {
414 sprintf(buf, "Delete the filesystem named %s (y/n)?", name);
415 switch (YesNoQuestion(buf, FALSE))
416 {
075fe5bb 417 case FALSE:
5eaef520 418 Put_message("Filesystem Not Deleted, continuing...\n");
419 return SUB_NORMAL;
075fe5bb 420 case TRUE:
5eaef520 421 break;
075fe5bb 422 default:
5eaef520 423 Put_message("Filesystem Not Deleted, aborting...\n\n");
424 return SUB_ERROR;
08345b74 425 }
426 }
5eaef520 427 if ((status = do_mr_query("delete_filesys", 1, &name, Scream,
428 NULL)) != MR_SUCCESS)
429 {
430 com_err(program_name, status, " in delete_filesys.");
431 return SUB_ERROR;
08345b74 432 }
5eaef520 433 else
434 Put_message("Filesystem Successfully Deleted.");
435 break;
075fe5bb 436 default:
5eaef520 437 com_err(program_name, status, " in get_filesystem_by_label).");
438 return SUB_ERROR;
08345b74 439 }
5eaef520 440 return SUB_NORMAL;
08345b74 441}
442
beeb13bf 443#ifndef ATHENA
075fe5bb 444/* Function Name: RealDeleteUser
445 * Description: Just Deletes the user.
446 * Arguments: name - name of User to delete
447 * Returns: SUB_ERROR if the deletion failed.
08345b74 448 */
449
5eaef520 450static int RealDeleteUser(char *name)
08345b74 451{
5eaef520 452 char buf[BUFSIZ];
453 int status;
454
455 if ((status = do_mr_query("delete_user", 1, &name, Scream,
456 NULL)) != MR_SUCCESS)
457 {
458 com_err(program_name, status, ": user not deleted");
459 return SUB_ERROR;
08345b74 460 }
5eaef520 461 sprintf(buf, "User %s deleted.", name);
462 Put_message(buf);
463 return SUB_NORMAL;
08345b74 464}
beeb13bf 465#endif
08345b74 466
85ca828a 467/* Function Name: RealDeleteList
468 * Description: Just Deletes the list.
469 * Arguments: name - name of list to delete
470 * Returns: SUB_ERROR if the deletion failed.
08345b74 471 */
472
5eaef520 473static int RealDeleteList(char *name)
08345b74 474{
5eaef520 475 char buf[BUFSIZ];
476 int status;
477
478 if ((status = do_mr_query("delete_list", 1, &name, Scream,
479 NULL)) != MR_SUCCESS)
480 {
481 com_err(program_name, status, ": list not deleted");
482 return SUB_ERROR;
08345b74 483 }
5eaef520 484 sprintf(buf, "List %s deleted.", name);
485 Put_message(buf);
486 Put_message("");
487 return SUB_NORMAL;
85ca828a 488}
08345b74 489
85ca828a 490/* Function Name: AttemptToDeleteList
491 * Description: Atempts to delete list, in the following manner:
492 * 1) try to delet it, if this fails in a known error then
493 * a) try to clean up each of those known methods, or
494 * at least explain why we failed.
402461ad 495 * Arguments: list_info - info about this list.
85ca828a 496 * ask_first - (T/F) query user before preparing for deletion,
497 * and cleaning up?
498 * Returns: none - all is taken care of and error messages printed
499 * one way or the other.
08345b74 500 */
501
5eaef520 502void AttemptToDeleteList(char **list_info, Bool ask_first)
85ca828a 503{
5eaef520 504 int status;
505 struct qelem *local, *member_of;
506 char *name = list_info[L_NAME];
507 member_of = NULL;
508
509 /*
510 * Attempt delete. - will only work if:
511 * 1) This list has no members.
512 * 2) This list in a member of no other lists.
513 * 3) This list is not an ace of another object.
514 */
515
516 switch ((status = do_mr_query("delete_list", 1, &name, Scream, NULL)))
517 {
8defc06b 518 case MR_SUCCESS:
5eaef520 519 Put_message("List Sucessfully Deleted.");
520 CheckAce(list_info[L_ACE_TYPE], list_info[L_ACE_NAME], ask_first);
521 break;
8defc06b 522 case MR_IN_USE:
5eaef520 523 /*
524 * This list is in use. Try to find out why,
525 * and for the cases where we have a good idea of
526 * what to do we will query and then do it.
527 */
528
529 if ((CheckIfAce(name, "list", ask_first) != SUB_NORMAL) ||
530 (RemoveItemFromLists(name, "list",
531 &member_of, ask_first) != SUB_NORMAL))
532 break;
533 /*
534 * If the list is it's own ACL, then make the person performing
535 * the delete the owner before removing this person from the list
536 */
537 if (!strcmp(list_info[L_ACE_TYPE], "LIST") &&
538 !strcmp(list_info[L_ACE_NAME], list_info[L_NAME]))
539 {
540 free(list_info[L_ACE_TYPE]);
541 free(list_info[L_ACE_NAME]);
542 list_info[L_ACE_TYPE] = Strsave("USER");
543 list_info[L_ACE_NAME] = Strsave(user);
544 SlipInNewName(list_info, Strsave(list_info[L_NAME]));
545 if ((status = do_mr_query("update_list", CountArgs(list_info) - 3,
546 list_info, Scream, NULL)) != MR_SUCCESS)
547 {
548 com_err(program_name, status, " while updating list owner");
549 Put_message("List may be only partly deleted.");
550 }
60b3185f 551 }
5eaef520 552 if ((RemoveMembersOfList(name, ask_first) == SUB_NORMAL) &&
553 (RealDeleteList(name) == SUB_NORMAL))
85ca828a 554 { /* if... */
5eaef520 555 CheckAce(list_info[L_ACE_TYPE], list_info[L_ACE_NAME], ask_first);
556
557 local = QueueTop(member_of);
558 while (local)
559 {
560 char **info = (char **) local->q_data;
561 if (CheckListForDeletion(info[LM_LIST], ask_first) == SUB_ERROR)
562 break;
563 local = local->q_forw;
85ca828a 564 }
5eaef520 565 FreeQueue(member_of);
08345b74 566 }
5eaef520 567 break;
85ca828a 568 default:
5eaef520 569 com_err(program_name, status, " in DeleteList (delete_list).");
570 break;
08345b74 571 }
08345b74 572}
573
85ca828a 574/* Function Name: DeleteList
575 * Description: deletes a list
59ec8dae 576 * Arguments: argc, argv - standard Moira argc and argv.
85ca828a 577 * Returns: DM Status Code.
08345b74 578 */
579
5eaef520 580int DeleteList(int argc, char *argv[])
08345b74 581{
5eaef520 582 char buf[BUFSIZ];
583 struct qelem *top, *list;
44d12d58 584 int status;
5eaef520 585 Bool one_list;
586
587 list = NULL;
588
589 switch ((status = do_mr_query("get_list_info", 1, argv + 1,
590 StoreInfo, (char *) &list)))
591 {
8defc06b 592 case MR_SUCCESS:
5eaef520 593 break;
594#if 0
595 case MR_NO_WILDCARD:
596 Put_message("Wildcards are not accepted here.");
597 return DM_NORMAL;
598#endif
599 case MR_NO_MATCH:
8defc06b 600 case MR_LIST:
5eaef520 601 Put_message("There is no list that matches that name.");
602 return DM_NORMAL;
85ca828a 603 default:
5eaef520 604 com_err(program_name, status, " in DeleteList (get_list_info).");
605 return DM_NORMAL;
08345b74 606 }
5eaef520 607
608 top = list = QueueTop(list);
609 one_list = (QueueCount(list) == 1);
610 while (list)
611 {
612 char **info = (char **) list->q_data;
613 if (one_list)
614 {
615 sprintf(buf, "Are you sure that you want to delete the list %s",
616 info[L_NAME]);
617 if (Confirm(buf))
618 AttemptToDeleteList(info, TRUE);
85ca828a 619 }
5eaef520 620 else
621 {
622 sprintf(buf, "Delete the list %s", info[L_NAME]);
623 switch (YesNoQuestion(buf, FALSE))
624 {
85ca828a 625 case TRUE:
5eaef520 626 AttemptToDeleteList(info, TRUE);
627 break;
85ca828a 628 case FALSE:
5eaef520 629 break;
85ca828a 630 default:
5eaef520 631 Put_message("Aborting...");
632 FreeQueue(top);
633 return DM_QUIT;
85ca828a 634 }
635 }
5eaef520 636 list = list->q_forw;
85ca828a 637 }
5eaef520 638 FreeQueue(top);
639 return DM_NORMAL;
08345b74 640}
641
642/* Function Name: DeleteUser
643 * Description: Deletes a user from the database.
644 * Arguments: argc, argv - name of the user in argv[1].
645 * Returns: DM_NORMAL.
646 */
647
5eaef520 648int DeleteUser(int argc, char **argv)
08345b74 649{
5eaef520 650 int status;
651 char buf[BUFSIZ];
652 char *name = argv[1]; /* name of the user we are deleting. */
beeb13bf 653#ifndef ATHENA
5eaef520 654 struct qelem *local, *member_of = NULL;
beeb13bf 655#endif
08345b74 656
5eaef520 657 if (!ValidName(name))
658 return DM_NORMAL;
075fe5bb 659
5eaef520 660 if (!Confirm("Are you sure that you want to delete this user?"))
661 return DM_NORMAL;
08345b74 662
5eaef520 663 status = do_mr_query("delete_user", 1, &name, Scream, NULL);
664 if (status != MR_IN_USE && status != 0)
665 {
666 com_err(program_name, status, ": user not deleted");
667 return DM_NORMAL;
08345b74 668 }
5eaef520 669 if (status == 0)
670 {
671 sprintf(buf, "User %s deleted.", name);
672 Put_message(buf);
beeb13bf 673#ifdef ATHENA
5eaef520 674 /* delete this return if the policy decision below is reversed */
675 return DM_NORMAL;
beeb13bf 676#endif
08345b74 677 }
beeb13bf 678#ifdef ATHENA
5eaef520 679 /* Design decision not to allow registered users to be deleted.
680 */
681 Put_message("Sorry, registered users cannot be deleted from the database.");
682 Put_message("Deactivate the user now, and the system manager will expunge later.");
beeb13bf 683#else
5eaef520 684 else if (status == MR_IN_USE)
685 {
686
687 /*
688 * Check:
689 * 1) Query - Delete home filesytem.
690 * 2) Query - Delete user Group.
691 * 2) Is the user an ACE of any object in the database?
692 * 3) Query - Remove user from all list of which he is a member.
693 *
694 * If all these have been accomplished, then attempt to delete
695 * the user again.
696 */
697 if ((DeleteHomeFilesys(name, TRUE) == SUB_ERROR) ||
698 (DeleteUserGroup(name, TRUE) == SUB_ERROR) ||
699 (CheckIfAce(name, "user", TRUE) == SUB_ERROR) ||
700 (RemoveItemFromLists(name, "user", &member_of, TRUE) == SUB_ERROR) ||
701 (RealDeleteUser(name) == SUB_ERROR))
702 return DM_NORMAL;
08345b74 703 }
704
5eaef520 705 /*
706 * Query - Delete all empty lists created by removing this user from them.
707 */
08345b74 708
5eaef520 709 local = member_of;
710 while (local)
711 {
712 char **info = (char **) local->q_data;
713 if (CheckListForDeletion(info[0], TRUE) == SUB_ERROR)
714 break;
715 local = local->q_forw;
08345b74 716 }
717
5eaef520 718 FreeQueue(member_of); /* Free memory and return. */
253517e2 719#endif
5eaef520 720 return DM_NORMAL;
08345b74 721}
This page took 0.203107 seconds and 5 git commands to generate.