static int InsertSortedImapPart(int argc, char **argv, void *arg)
{
- struct mqelem *new, *elem, *prev, **parts = arg;
+ struct mqelem *new = NULL;
+ struct mqelem *elem, *prev, **parts = arg;
int avail = atoi(argv[NFS_SIZE]) - atoi(argv[NFS_ALLOC]);
/* Dup the argv into a new mqelem. */
char *CreateImapBox(char *user)
{
int status;
- struct mqelem *elem, *servers = NULL, *partitions = NULL;
+ struct mqelem *elem = NULL, *servers = NULL, *partitions = NULL;
char *server = NULL, *partition = NULL;
char *argv[11], *fsname, temp_buf[BUFSIZ];
static char *default_imap_quota = NULL;
char **pargv = elem->q_data;
if (!strcmp(partition, pargv[NFS_DIR]))
break;
+ elem = elem->q_forw;
}
if (!elem)
{
{
int status;
char *type, temp_buf[BUFSIZ], *local_user, *args[10], *box;
- char *temp_box;
struct mqelem *top = NULL;
local_user = argv[1];
}
/* Fall through from MR_MACHINE case. */
case FALSE:
- type = strdup("POP");
+ type = strdup("IMAP");
if (GetValueFromUser("Kind of Local PO Box?", &type) == SUB_ERROR)
{
free(type);
{
free(type);
type = "IMAP";
- if ((box = CreateImapBox(local_user)) == (char *) SUB_ERROR)
- return DM_NORMAL;
+ switch (YesNoQuestion("Create IMAP filesystem (y/n)", TRUE))
+ {
+ case TRUE:
+ if ((box = CreateImapBox(local_user)) == (char *) SUB_ERROR)
+ return DM_NORMAL;
+ break;
+ case FALSE:
+ box = malloc(strlen(local_user) + 4);
+ sprintf(box, "%s.po", local_user);
+ break;
+ default:
+ return DM_NORMAL;
+ }
+ }
+ else if (!strcasecmp(type, "EXCHANGE"))
+ {
+ free(type);
+ type = "EXCHANGE";
+ box = "EXCHANGE.MIT.EDU";
}
else
{
return DM_NORMAL;
if (mrcl_validate_pobox_smtp(local_user, temp_buf, &box) !=
MRCL_SUCCESS)
- return DM_NORMAL;
+ {
+ if (mrcl_get_message())
+ Put_message(mrcl_get_message());
+ return DM_NORMAL;
+ }
break;
case FALSE:
default:
return DM_NORMAL;
}
+/* Function Name: SplitUserPOBox
+ * Description: Splits the user's PO Box between local and SMTP
+ * Arguments: argc, argv - name of user in argv[1].
+ * Returns: DM_NORMAL.
+ */
+
+int SplitUserPOBox(int argc, char **argv)
+{
+ char temp_buf[BUFSIZ], *args[3], *box;
+ int status;
+
+ if (!ValidName(argv[1]))
+ return DM_NORMAL;
+
+ if (!Prompt_input("Foreign PO Box for this user? ", temp_buf, BUFSIZ))
+ return DM_NORMAL;
+ if (mrcl_validate_pobox_smtp(argv[1], temp_buf, &box) !=
+ MRCL_SUCCESS)
+ {
+ if (mrcl_get_message())
+ Put_message(mrcl_get_message());
+ return DM_NORMAL;
+ }
+
+ args[0] = argv[1];
+ args[1] = "SPLIT";
+ args[2] = box;
+
+ status = do_mr_query("set_pobox", 3, args, NULL, NULL);
+ if (status == MR_MACHINE)
+ Put_message("User has no local PO Box--PO Box unchanged.");
+ else if (status)
+ com_err(program_name, status, " in SplitUserPOBox");
+ else
+ Put_message("PO Box split.");
+ free(box);
+
+ return DM_NORMAL;
+}
+
/* Function Name: RemoveUserPOBox
* Description: Removes this users POBox.
* Arguments: argc, argv - name of user in argv[1].