Commit 7191f1db 7191f1dbdd3126049245ae0cd984fed0db7cc6a3 by Alain Magloire

* mailbox/mutil.c (getpwma_virtual): Memory overrun, did not

	reserve enough space to accomodate the extra slash, when
	doing the sprintf().
	Include <string.h>, since we use strdup().
1 parent 04e5fd24
2001-09-02 Alain Magloire
* mailbox/mutil.c (getpwma_virtual): Memory overrun, did not
reserve enough space to accomodate the extra slash, when
doing the sprintf().
Include <string.h>, since we use strdup().
2001-08-31 Jakob 'sparky' Kaivo <jkaivo@elijah.nodomainname.net>
* imap4d/list.c (list_file): don't show INBOX if virtual
2001-08-31 Sergey Poznyakoff
* mailbix/mutil.c: Fixed declaration of _app_getpwnam.
Moved mu_virtual_domain out of #ifdef guard. Fixed typo
in getpwnam_virtual: erroneously returned NULL instead of
in getpwnam_virtual: erroneously returned NULL instead of
p.
2001-08-31 Sergey Poznyakoff
......
......@@ -28,6 +28,7 @@
#include <time.h>
#include <pwd.h>
#include <unistd.h>
#include <string.h>
#include <mailutils/mutil.h>
#include <mailutils/iterator.h>
......@@ -342,7 +343,7 @@ mu_getpwnam (const char *name)
struct passwd *p;
iterator_t itr;
p = getpwnam (name);
p = getpwnam (name);
if (!p && iterator_create (&itr, _app_getpwnam) == 0)
{
......@@ -370,7 +371,7 @@ getpwnam_virtual (const char *u)
FILE *pfile;
int i = 0, len = strlen (u), delim = 0;
char *filename;
mu_virtual_domain = 0;
for (i = 0; i < len && delim == 0; i++)
if (u[i] == '!' || u[i] == ':' || u[i] == '@')
......@@ -380,14 +381,14 @@ getpwnam_virtual (const char *u)
return NULL;
filename = malloc (strlen (SITE_VIRTUAL_PWDDIR) +
strlen (&u[delim + 1]) + 1);
strlen (&u[delim + 1]) + 2 /* slash and null byte */);
if (filename == NULL)
return NULL;
sprintf (filename, "%s/%s", SITE_VIRTUAL_PWDDIR, &u[delim + 1]);
pfile = fopen (filename, "r");
free (filename);
if (pfile)
while ((pw = fgetpwent (pfile)) != NULL)
{
......