validate maildirs more strictly
now that "SyncState *" won't create fake mailboxes any more, we can make a full validity check again.
This commit is contained in:
parent
05fd0b9970
commit
3169c59e10
|
@ -231,7 +231,7 @@ maildir_validate( const char *prefix, const char *box, int create, maildir_store
|
|||
DIR *dirp;
|
||||
struct dirent *entry;
|
||||
time_t now;
|
||||
int i, j, bl;
|
||||
int i, bl;
|
||||
struct stat st;
|
||||
char buf[_POSIX_PATH_MAX];
|
||||
|
||||
|
@ -245,7 +245,6 @@ maildir_validate( const char *prefix, const char *box, int create, maildir_store
|
|||
maildir_invoke_bad_callback( &ctx->gen );
|
||||
return DRV_CANCELED;
|
||||
}
|
||||
mkdirs:
|
||||
for (i = 0; i < 3; i++) {
|
||||
memcpy( buf + bl, subdirs[i], 4 );
|
||||
if (mkdir( buf, 0700 )) {
|
||||
|
@ -264,17 +263,13 @@ maildir_validate( const char *prefix, const char *box, int create, maildir_store
|
|||
return DRV_BOX_BAD;
|
||||
}
|
||||
} else {
|
||||
for (i = j = 0; i < 3; i++) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
memcpy( buf + bl, subdirs[i], 4 );
|
||||
if (!stat( buf, &st ) && S_ISDIR(st.st_mode))
|
||||
j++;
|
||||
}
|
||||
if (!j)
|
||||
goto mkdirs;
|
||||
if (j != 3) {
|
||||
if (stat( buf, &st ) || !S_ISDIR(st.st_mode)) {
|
||||
error( "Maildir error: '%.*s' is no valid mailbox\n", bl, buf );
|
||||
return DRV_BOX_BAD;
|
||||
}
|
||||
}
|
||||
memcpy( buf + bl, "tmp/", 5 );
|
||||
bl += 4;
|
||||
if (!(dirp = opendir( buf ))) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user