doveadm-fs.c revision 95c13a27352739261c53ecd23fe2f0c3d61aa06f
/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "md5.h"
#include "sha2.h"
#include "hash-method.h"
#include "hex-binary.h"
#include "istream.h"
#include "ostream.h"
#include "iostream-ssl.h"
#include "fs-api.h"
#include "doveadm.h"
#include <stdio.h>
#include <unistd.h>
static struct fs *
{
struct ssl_iostream_settings ssl_set;
struct fs_settings fs_set;
const char *error;
*argc += 3;
*argv += 3;
return fs;
}
{
const unsigned char *data;
}
} else if (input->stream_errno != 0) {
}
}
{
enum fs_properties props;
int c;
switch (c) {
case 'h':
i_fatal("Invalid -h parameter: Hash not in hex");
break;
default:
}
}
;
if ((props & FS_PROPERTY_WRITE_HASH_MD5) == 0)
i_fatal("fs backend doesn't support MD5 hashes");
if ((props & FS_PROPERTY_WRITE_HASH_SHA256) == 0)
i_fatal("fs backend doesn't support SHA256 hashes");
}
if (output->stream_errno != 0)
else
}
i_error("fs_write_stream_finish() failed: %s",
}
}
{
} else {
i_error("fs_copy(%s, %s) failed: %s",
}
}
{
} else {
i_error("fs_stat(%s) failed: %s",
}
}
{
const struct fs_metadata *m;
} else {
i_error("fs_stat(%s) failed: %s",
}
}
struct fs_delete_ctx {
unsigned int files_count;
};
{
unsigned int i;
for (i = 0; i < ctx->files_count; i++) {
;
else {
i_error("fs_delete(%s) failed: %s",
}
}
return ret;
}
static void
const char *path)
{
struct fs_delete_ctx ctx;
unsigned int i;
/* delete subdirs first. all fs backends can't handle recursive
lookups, so save the list first. */
}
if (fs_iter_deinit(&iter) < 0) {
i_error("fs_iter_deinit(%s) failed: %s",
}
} T_END;
/* delete files. again because we're doing this asynchronously finish
the iteration first. */
/* we need to explicitly delete also the directories */
} else {
}
}
if (fs_iter_deinit(&iter) < 0) {
i_error("fs_iter_deinit(%s) failed: %s",
}
for (i = 0; i < ctx.files_count; i++) {
continue;
break;
}
if (fs_wait_async(fs) < 0) {
break;
}
goto retry;
}
} T_END;
if (fs_wait_async(fs) < 0) {
break;
}
}
for (i = 0; i < ctx.files_count; i++) {
}
}
static void
{
const char *path;
/* delete the root itself */
i_error("fs_delete(%s) failed: %s",
}
}
}
{
unsigned int async_count = 0;
int c;
switch (c) {
case 'R':
break;
case 'n':
break;
default:
}
}
if (recursive) {
return;
}
;
} else {
i_error("fs_delete(%s) failed: %s",
}
}
{
const char *fname;
if (fs_iter_deinit(&iter) < 0) {
i_error("fs_iter_deinit(%s) failed: %s",
}
}
{
}
{
}
struct doveadm_cmd doveadm_cmd_fs[] = {
};
{
unsigned int i;
for (i = 0; i < N_ELEMENTS(doveadm_cmd_fs); i++) {
help(&doveadm_cmd_fs[i]);
}
i_unreached();
}
void doveadm_register_fs_commands(void)
{
unsigned int i;
for (i = 0; i < N_ELEMENTS(doveadm_cmd_fs); i++)
}