diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 1998-08-25 22:33:07 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 1998-08-25 22:33:07 +0000 |
commit | 986ab5e943db7aaed2aed98f8b74e4c26666fdd8 (patch) | |
tree | 58cfec1114686823dbdbf22cf2ca52f77eb1075d /main.c | |
parent | 9044dd4d58af4b4d64a6e68b7b76c42d317e7ce5 (diff) |
CVS branch clean-up.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 60 |
1 files changed, 26 insertions, 34 deletions
@@ -126,11 +126,6 @@ static void show_version (void) #endif puts ( -#ifdef HIDDEN_HOST - "+HIDDEN_HOST " -#else - "-HIDDEN_HOST " -#endif #ifdef HOMESPOOL "+HOMESPOOL " @@ -251,7 +246,7 @@ static void show_version (void) - puts ("\nMail bug reports along with this output to <mutt-dev@cs.hmc.edu>."); + puts ("\nMail bug reports along with this output to <mutt-dev@mutt.org>."); exit (0); } @@ -312,34 +307,21 @@ int main (int argc, char **argv) extern char *optarg; extern int optind; - mutt_error = mutt_nocurses_error; + /* sanity check against stupid administrators */ + + if(getegid() != getgid()) + { + fprintf(stderr, "%s: I don't want to run with privileges!\n", + argv[0]); + exit(1); + } + + mutt_error = mutt_nocurses_error; SRAND (time (NULL)); setlocale (LC_CTYPE, ""); umask (077); -#ifdef USE_SETGID - /* Determine the user's default gid and the gid to use for locking the spool - * mailbox on those systems which require setgid "mail" to write to the - * directory. This function also resets the gid to "normal" since the - * effective gid will be "mail" when we start (Mutt attempts to run - * non-setgid whenever possible to reduce the possibility of security holes). - */ - - /* Get the default gid for the user */ - UserGid = getgid (); - - /* it is assumed that we are setgid to the correct gid to begin with */ - MailGid = getegid (); - - /* reset the effective gid to the normal gid */ - if (SETEGID (UserGid) != 0) - { - perror ("setegid"); - exit (0); - } -#endif - memset (Options, 0, sizeof (Options)); while ((i = getopt (argc, argv, "a:b:F:f:c:d:e:H:s:i:hm:npRvxyzZ")) != EOF) @@ -553,7 +535,7 @@ int main (int argc, char **argv) mutt_endwin (NULL); perror (tempfile); fclose (fin); - free (tempfile); + FREE (&tempfile); exit (1); } @@ -573,11 +555,11 @@ int main (int argc, char **argv) { if (a) { - a->next = mutt_make_attach (t->data); + a->next = mutt_make_file_attach (t->data); a = a->next; } else - msg->content = a = mutt_make_attach (t->data); + msg->content = a = mutt_make_file_attach (t->data); if (!a) { if (!option (OPTNOCURSES)) @@ -620,7 +602,7 @@ int main (int argc, char **argv) } if (!folder[0]) - strfcpy (folder, Spoolfile, sizeof (folder)); + strfcpy (folder, NONULL(Spoolfile), sizeof (folder)); mutt_expand_path (folder, sizeof (folder)); if (flags & M_IGNORE) @@ -645,7 +627,17 @@ int main (int argc, char **argv) if ((Context = mx_open_mailbox (folder, ((flags & M_RO) || option (OPTREADONLY)) ? M_READONLY : 0, NULL)) != NULL) { - mutt_index_menu (); + int close = mutt_index_menu (0); + + if (Context) + { + if (close == OP_QUIT) + mx_close_mailbox (Context); + else + mx_fastclose_mailbox (Context); + } + + safe_free ((void **)&Context); mutt_endwin (NULL); } else |