本文整理汇总了C++中pool_datastack_create函数的典型用法代码示例。如果您正苦于以下问题:C++ pool_datastack_create函数的具体用法?C++ pool_datastack_create怎么用?C++ pool_datastack_create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pool_datastack_create函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_hmac_test_vectors
static
void test_hmac_test_vectors(void)
{
test_begin("test_hmac_test_vectors");
buffer_t *pt, *ct, *key, *res;
pt = buffer_create_dynamic(pool_datastack_create(), 50);
key = buffer_create_dynamic(pool_datastack_create(), 20);
ct = buffer_create_dynamic(pool_datastack_create(), 32);
res = buffer_create_dynamic(pool_datastack_create(), 32);
hex_to_binary("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", key);
hex_to_binary("dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd", pt);
hex_to_binary("773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe", res);
struct dcrypt_context_hmac *hctx;
if (!dcrypt_ctx_hmac_create("sha256", &hctx, NULL)) {
test_assert_failed("dcrypt_ctx_hmac_create", __FILE__, __LINE__-1);
} else {
dcrypt_ctx_hmac_set_key(hctx, key->data, key->used);
test_assert(dcrypt_ctx_hmac_init(hctx, NULL));
test_assert(dcrypt_ctx_hmac_update(hctx, pt->data, pt->used, NULL));
test_assert(dcrypt_ctx_hmac_final(hctx, ct, NULL));
test_assert(buffer_cmp(ct, res));
dcrypt_ctx_hmac_destroy(&hctx);
}
test_end();
}
开发者ID:bechtoldt,项目名称:dovecot-core,代码行数:29,代码来源:test-crypto.c
示例2: cmd_login
int cmd_login(struct imap_client *imap_client, const struct imap_arg *args)
{
struct client *client = &imap_client->common;
const char *user, *pass;
string_t *plain_login, *base64;
/* two arguments: username and password */
if (!imap_arg_get_astring(&args[0], &user) ||
!imap_arg_get_astring(&args[1], &pass) ||
!IMAP_ARG_IS_EOL(&args[2]))
return -1;
if (!client_check_plaintext_auth(client, TRUE))
return 1;
/* authorization ID \0 authentication ID \0 pass */
plain_login = buffer_create_dynamic(pool_datastack_create(), 64);
buffer_append_c(plain_login, '\0');
buffer_append(plain_login, user, strlen(user));
buffer_append_c(plain_login, '\0');
buffer_append(plain_login, pass, strlen(pass));
base64 = buffer_create_dynamic(pool_datastack_create(),
MAX_BASE64_ENCODED_SIZE(plain_login->used));
base64_encode(plain_login->data, plain_login->used, base64);
return imap_client_auth_begin(imap_client, "PLAIN", str_c(base64));
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:27,代码来源:client-authenticate.c
示例3: buffer_create_dynamic
const char *client_get_session_id(struct client *client)
{
buffer_t *buf, *base64_buf;
struct timeval tv;
uint64_t timestamp;
unsigned int i;
if (client->session_id != NULL)
return client->session_id;
buf = buffer_create_dynamic(pool_datastack_create(), 24);
base64_buf = buffer_create_dynamic(pool_datastack_create(), 24*2);
if (gettimeofday(&tv, NULL) < 0)
i_fatal("gettimeofday(): %m");
timestamp = tv.tv_usec + (long long)tv.tv_sec * 1000ULL*1000ULL;
/* add lowest 48 bits of the timestamp. this gives us a bit less than
9 years until it wraps */
for (i = 0; i < 48; i += 8)
buffer_append_c(buf, (timestamp >> i) & 0xff);
buffer_append_c(buf, client->remote_port & 0xff);
buffer_append_c(buf, (client->remote_port >> 16) & 0xff);
#ifdef HAVE_IPV6
if (IPADDR_IS_V6(&client->ip))
buffer_append(buf, &client->ip.u.ip6, sizeof(client->ip.u.ip6));
else
#endif
buffer_append(buf, &client->ip.u.ip4, sizeof(client->ip.u.ip4));
base64_encode(buf->data, buf->used, base64_buf);
client->session_id = p_strdup(client->pool, str_c(base64_buf));
return client->session_id;
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:34,代码来源:client-common.c
示例4: test_fts_icu_translate_resize
static void test_fts_icu_translate_resize(void)
{
const char *translit_id = "Any-Hex";
const char *src_utf8 = "FOO";
buffer_t *dest, *src_utf16;
UTransliterator *translit;
const char *error;
unsigned int i;
test_begin("fts_icu_translate_resize resize");
src_utf16 = buffer_create_dynamic(pool_datastack_create(), 16);
translit = get_translit(translit_id);
for (i = 2; i <= 20; i++) {
buffer_set_used_size(src_utf16, 0);
fts_icu_utf8_to_utf16(src_utf16, src_utf8);
dest = buffer_create_dynamic(pool_datastack_create(), i);
test_assert(buffer_get_size(dest) == i);
test_assert(fts_icu_translate(dest, src_utf16->data,
src_utf16->used/sizeof(UChar),
translit, &error) == 0);
}
utrans_close(translit);
test_end();
}
开发者ID:Raffprta,项目名称:core,代码行数:26,代码来源:test-fts-icu.c
示例5: index_storage_attribute_get
int index_storage_attribute_get(struct mailbox_transaction_context *t,
enum mail_attribute_type type, const char *key,
struct mail_attribute_value *value_r)
{
struct dict *dict;
const char *mailbox_prefix;
int ret;
memset(value_r, 0, sizeof(*value_r));
if (strncmp(key, MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT,
strlen(MAILBOX_ATTRIBUTE_PREFIX_DOVECOT_PVT)) == 0)
return 0;
if (index_storage_get_dict(t->box, type, &dict, &mailbox_prefix) < 0)
return -1;
ret = dict_lookup(dict, pool_datastack_create(),
key_get_prefixed(type, mailbox_prefix, key),
&value_r->value);
if (ret < 0) {
mail_storage_set_internal_error(t->box->storage);
return -1;
}
return ret;
}
开发者ID:jwm,项目名称:dovecot-notmuch,代码行数:26,代码来源:index-attribute.c
示例6: acl_mailbox_exists
static int acl_mailbox_exists(struct mailbox *box, bool auto_boxes,
enum mailbox_existence *existence_r)
{
struct acl_mailbox *abox = ACL_CONTEXT(box);
const char *const *rights;
unsigned int i;
if (acl_object_get_my_rights(abox->aclobj, pool_datastack_create(),
&rights) < 0)
return -1;
/* for now this is used only by IMAP SUBSCRIBE. we'll intentionally
violate RFC 4314 here, because it says SUBSCRIBE should succeed only
when mailbox has 'l' right. But there's no point in not allowing
a subscribe for a mailbox that can be selected anyway. Just the
opposite: subscribing to such mailboxes is a very useful feature. */
for (i = 0; rights[i] != NULL; i++) {
if (strcmp(rights[i], MAIL_ACL_LOOKUP) == 0 ||
strcmp(rights[i], MAIL_ACL_READ) == 0 ||
strcmp(rights[i], MAIL_ACL_INSERT) == 0)
return abox->module_ctx.super.exists(box, auto_boxes,
existence_r);
}
*existence_r = MAILBOX_EXISTENCE_NONE;
return 0;
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:26,代码来源:acl-mailbox.c
示例7: test_ostream_dot_one
static void test_ostream_dot_one(const struct dot_test *test)
{
struct istream *test_input;
struct ostream *output, *test_output;
buffer_t *output_data;
const unsigned char *data;
size_t size;
ssize_t ret;
test_input = test_istream_create(test->input);
output_data = buffer_create_dynamic(pool_datastack_create(), 1024);
test_output = o_stream_create_buffer(output_data);
output = o_stream_create_dot(test_output, FALSE);
while ((ret = i_stream_read(test_input)) > 0 || ret == -2) {
data = i_stream_get_data(test_input, &size);
ret = o_stream_send(output, data, size);
test_assert(ret >= 0);
if (ret <= 0)
break;
i_stream_skip(test_input, ret);
}
test_assert(test_input->eof);
test_assert(o_stream_flush(output) > 0);
o_stream_unref(&output);
o_stream_unref(&test_output);
test_assert(strcmp(str_c(output_data), test->output) == 0);
i_stream_unref(&test_input);
}
开发者ID:LTD-Beget,项目名称:dovecot,代码行数:34,代码来源:test-ostream-dot.c
示例8: test_quoted_printable_decode_final
static void test_quoted_printable_decode_final(void)
{
static struct test_quoted_printable_decode_data data[] = {
{ "=0A=0D ", "\n\r", 2, 0 },
{ "foo=", "foo", 1, 0 },
{ "foo ", "foo", 2, 0 },
{ "foo= ", "foo", 3, 0 },
{ "foo=A", "foo", 2, -1 }
};
buffer_t *buf;
unsigned int i, len;
size_t src_pos;
int ret;
test_begin("quoted printable decode final");
buf = buffer_create_dynamic(pool_datastack_create(), 128);
for (i = 0; i < N_ELEMENTS(data); i++) {
len = strlen(data[i].input);
ret = quoted_printable_decode_final((const void *)data[i].input,
len, &src_pos, buf);
test_assert(ret == data[i].ret);
test_assert(src_pos + data[i].end_skip == len);
test_assert(strcmp(data[i].output, str_c(buf)) == 0);
buffer_set_used_size(buf, 0);
}
test_end();
}
开发者ID:bdraco,项目名称:dovecot,代码行数:28,代码来源:test-quoted-printable.c
示例9: index_storage_attribute_get
int index_storage_attribute_get(struct mailbox *box,
enum mail_attribute_type type, const char *key,
struct mail_attribute_value *value_r,
bool internal_attribute)
{
struct dict *dict;
const char *mailbox_prefix, *error;
int ret;
memset(value_r, 0, sizeof(*value_r));
if (!internal_attribute &&
!MAILBOX_ATTRIBUTE_KEY_IS_USER_ACCESSIBLE(key))
return 0;
if (index_storage_get_dict(box, type, &dict, &mailbox_prefix) < 0)
return -1;
ret = dict_lookup(dict, pool_datastack_create(),
key_get_prefixed(type, mailbox_prefix, key),
&value_r->value, &error);
if (ret < 0) {
mail_storage_set_critical(box->storage,
"Failed to set attribute %s: %s", key, error);
return -1;
}
return ret;
}
开发者ID:nikwrt,项目名称:dovecot-core,代码行数:28,代码来源:index-attribute.c
示例10: o_stream_encrypt_send_header_v2
static
int o_stream_encrypt_send_header_v2(struct encrypt_ostream *stream)
{
unsigned char c;
unsigned int i;
i_assert(!stream->prefix_written);
stream->prefix_written = TRUE;
buffer_t *values = buffer_create_dynamic(pool_datastack_create(), 256);
buffer_append(values, IOSTREAM_CRYPT_MAGIC, sizeof(IOSTREAM_CRYPT_MAGIC));
c = 2;
buffer_append(values, &c, 1);
i = htonl(stream->flags);
buffer_append(values, &i, 4);
/* store total length of header
9 = version + flags + length
8 = rounds + key data length
*/
i = htonl(sizeof(IOSTREAM_CRYPT_MAGIC) + 9 + stream->cipher_oid->used + stream->mac_oid->used + 8 + stream->key_data_len);
buffer_append(values, &i, 4);
buffer_append_buf(values, stream->cipher_oid, 0, (size_t)-1);
buffer_append_buf(values, stream->mac_oid, 0, (size_t)-1);
i = htonl(IO_STREAM_ENCRYPT_ROUNDS);
buffer_append(values, &i, 4);
i = htonl(stream->key_data_len);
buffer_append(values, &i, 4);
buffer_append(values, stream->key_data, stream->key_data_len);
i_free_and_null(stream->key_data);
return o_stream_encrypt_send(stream, values->data, values->used);
}
开发者ID:manuelm,项目名称:dovecot,代码行数:33,代码来源:ostream-encrypt.c
示例11: log_get_hdr_update_buffer
static const buffer_t *
log_get_hdr_update_buffer(struct mail_index_transaction *t, bool prepend)
{
buffer_t *buf;
const unsigned char *data, *mask;
struct mail_transaction_header_update u;
uint16_t offset;
int state = 0;
memset(&u, 0, sizeof(u));
data = prepend ? t->pre_hdr_change : t->post_hdr_change;
mask = prepend ? t->pre_hdr_mask : t->post_hdr_mask;
buf = buffer_create_dynamic(pool_datastack_create(), 256);
for (offset = 0; offset <= sizeof(t->pre_hdr_change); offset++) {
if (offset < sizeof(t->pre_hdr_change) && mask[offset]) {
if (state == 0) {
u.offset = offset;
state++;
}
} else {
if (state > 0) {
u.size = offset - u.offset;
buffer_append(buf, &u, sizeof(u));
buffer_append(buf, data + u.offset, u.size);
state = 0;
}
}
}
return buf;
}
开发者ID:via,项目名称:dovecot-clouddb,代码行数:32,代码来源:mail-index-transaction-export.c
示例12: passdb_dict_lookup_key
static enum passdb_result
passdb_dict_lookup_key(struct auth_request *auth_request,
struct dict_passdb_module *module, const char *key)
{
const char *value;
int ret;
auth_request_log_debug(auth_request, "dict", "lookup %s", key);
ret = dict_lookup(module->conn->dict, pool_datastack_create(),
key, &value);
if (ret < 0) {
auth_request_log_error(auth_request, "dict", "Lookup failed");
return PASSDB_RESULT_INTERNAL_FAILURE;
} else if (ret == 0) {
auth_request_log_unknown_user(auth_request, "dict");
return PASSDB_RESULT_USER_UNKNOWN;
} else {
auth_request_log_debug(auth_request, "dict",
"result: %s", value);
if (dict_query_save_results(auth_request, module->conn, value) < 0)
return PASSDB_RESULT_INTERNAL_FAILURE;
if (auth_request->passdb_password == NULL &&
!auth_fields_exists(auth_request->extra_fields, "nopassword")) {
auth_request_log_info(auth_request, "dict",
"No password returned (and no nopassword)");
return PASSDB_RESULT_PASSWORD_MISMATCH;
} else {
return PASSDB_RESULT_OK;
}
}
}
开发者ID:damoxc,项目名称:dovecot,代码行数:32,代码来源:passdb-dict.c
示例13: fts_icu_transliterator_create
int fts_icu_transliterator_create(const char *id,
UTransliterator **transliterator_r,
const char **error_r)
{
UErrorCode err = U_ZERO_ERROR;
UParseError perr;
buffer_t *id_utf16_buf = buffer_create_dynamic(pool_datastack_create(), 2 * strlen(id));
UChar *id_utf16;
memset(&perr, 0, sizeof(perr));
fts_icu_utf8_to_utf16(id_utf16_buf, id);
id_utf16 = (UChar *)str_c(id_utf16_buf);
*transliterator_r = utrans_openU(id_utf16,
id_utf16_buf->used / sizeof(UChar),
UTRANS_FORWARD, NULL, 0, &perr, &err);
if (U_FAILURE(err)) {
string_t *str = t_str_new(128);
str_printfa(str, "Failed to open transliterator for id '%s': %s",
id, u_errorName(err));
if (perr.line >= 1) {
/* we have only one line in our ID */
str_printfa(str, " (parse error on offset %u)",
perr.offset);
}
*error_r = str_c(str);
return -1;
}
return 0;
}
开发者ID:jfsmig,项目名称:dovecot-core,代码行数:30,代码来源:fts-icu.c
示例14: acl_mailbox_try_list_fast
static void
acl_mailbox_try_list_fast(struct acl_mailbox_list_iterate_context *ctx)
{
struct acl_mailbox_list *alist = ACL_LIST_CONTEXT(ctx->ctx.list);
struct acl_backend *backend = alist->rights.backend;
const unsigned int *idxp;
const struct acl_mask *acl_mask;
struct acl_mailbox_list_context *nonowner_list_ctx;
struct mail_namespace *ns = ctx->ctx.list->ns;
struct mailbox_list_iter_update_context update_ctx;
const char *name;
int ret;
if ((ctx->ctx.flags & (MAILBOX_LIST_ITER_RAW_LIST |
MAILBOX_LIST_ITER_SELECT_SUBSCRIBED)) != 0)
return;
if (ns->type == MAIL_NAMESPACE_TYPE_PUBLIC) {
/* mailboxes in public namespace should all be listable to
someone. we don't benefit from fast listing. */
return;
}
/* if this namespace's default rights contain LOOKUP, we'll need to
go through all mailboxes in any case. */
idxp = alist->rights.acl_storage_right_idx + ACL_STORAGE_RIGHT_LOOKUP;
if (acl_backend_get_default_rights(backend, &acl_mask) < 0 ||
acl_cache_mask_isset(acl_mask, *idxp))
return;
/* no LOOKUP right by default, we can optimize this */
memset(&update_ctx, 0, sizeof(update_ctx));
update_ctx.iter_ctx = &ctx->ctx;
update_ctx.glob =
imap_match_init(pool_datastack_create(), "*",
(ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0,
ctx->sep);
update_ctx.match_parents = TRUE;
update_ctx.tree_ctx = mailbox_tree_init(ctx->sep);
nonowner_list_ctx = acl_backend_nonowner_lookups_iter_init(backend);
while ((ret = acl_backend_nonowner_lookups_iter_next(nonowner_list_ctx,
&name)) > 0) {
T_BEGIN {
const char *vname =
mailbox_list_get_vname(ns->list, name);
mailbox_list_iter_update(&update_ctx, vname);
} T_END;
}
acl_backend_nonowner_lookups_iter_deinit(&nonowner_list_ctx);
if (ret == 0)
ctx->lookup_boxes = update_ctx.tree_ctx;
else
mailbox_tree_deinit(&update_ctx.tree_ctx);
}
开发者ID:Raffprta,项目名称:core,代码行数:56,代码来源:acl-mailbox-list.c
示例15: main_init
static void main_init(void)
{
doveadm_server = TRUE;
doveadm_settings = master_service_settings_get_others(master_service)[0];
doveadm_settings = settings_dup(&doveadm_setting_parser_info,
doveadm_settings,
pool_datastack_create());
doveadm_mail_init();
doveadm_load_modules();
doveadm_print_init(DOVEADM_PRINT_TYPE_SERVER);
}
开发者ID:dhultin,项目名称:dovecot-pop-uidl-proxy,代码行数:12,代码来源:main.c
示例16: stats_add_session
static void stats_add_session(struct mail_user *user)
{
struct stats_user *suser = STATS_USER_CONTEXT(user);
struct stats *new_stats, *diff_stats;
const char *error;
new_stats = stats_alloc(pool_datastack_create());
diff_stats = stats_alloc(pool_datastack_create());
mail_user_stats_fill(user, new_stats);
/* we'll count new_stats-pre_io_stats and add the changes to
session_stats. the new_stats can't be directly copied to
session_stats because there are some fields that don't start from
zero, like clock_time. (actually with stats_global_user code we're
requiring that clock_time is the only such field..) */
if (!stats_diff(suser->pre_io_stats, new_stats, diff_stats, &error))
i_error("stats: session stats shrank: %s", error);
stats_add(suser->session_stats, diff_stats);
/* copying is only needed if stats_global_user=NULL */
stats_copy(suser->pre_io_stats, new_stats);
}
开发者ID:aclindsa,项目名称:dovecot_core,代码行数:21,代码来源:stats-plugin.c
示例17: mail_session_update_parse
int mail_session_update_parse(const char *const *args, const char **error_r)
{
struct mail_session *session;
struct stats *new_stats, *diff_stats;
buffer_t *buf;
const char *error;
/* <session id> <stats> */
if (mail_session_get(args[0], &session, error_r) < 0)
return -1;
buf = buffer_create_dynamic(pool_datastack_create(), 256);
if (args[1] == NULL ||
base64_decode(args[1], strlen(args[1]), NULL, buf) < 0) {
*error_r = t_strdup_printf("UPDATE-SESSION %s %s %s: Invalid base64 input",
session->user->name,
session->service, session->id);
return -1;
}
new_stats = stats_alloc(pool_datastack_create());
diff_stats = stats_alloc(pool_datastack_create());
if (!stats_import(buf->data, buf->used, session->stats, new_stats, &error)) {
*error_r = t_strdup_printf("UPDATE-SESSION %s %s %s: %s",
session->user->name,
session->service, session->id, error);
return -1;
}
if (!stats_diff(session->stats, new_stats, diff_stats, &error)) {
*error_r = t_strdup_printf("UPDATE-SESSION %s %s %s: stats shrank: %s",
session->user->name,
session->service, session->id, error);
i_panic("%s", *error_r);
return -1;
}
mail_session_refresh(session, diff_stats);
return 0;
}
开发者ID:jfsmig,项目名称:dovecot-core,代码行数:40,代码来源:mail-session.c
示例18: message_snippet_generate
int message_snippet_generate(struct istream *input,
unsigned int max_snippet_chars,
string_t *snippet)
{
struct message_parser_ctx *parser;
struct message_part *parts;
struct message_decoder_context *decoder;
struct message_block raw_block, block;
struct snippet_context ctx;
pool_t pool;
int ret;
memset(&ctx, 0, sizeof(ctx));
pool = pool_alloconly_create("message snippet", 1024);
ctx.snippet = snippet;
ctx.chars_left = max_snippet_chars;
parser = message_parser_init(pool_datastack_create(), input, 0, 0);
decoder = message_decoder_init(NULL, 0);
while ((ret = message_parser_parse_next_block(parser, &raw_block)) > 0) {
if (!message_decoder_decode_next_block(decoder, &raw_block, &block))
continue;
if (block.size == 0) {
const char *ct;
if (block.hdr != NULL)
continue;
/* end of headers - verify that we can use this
Content-Type. we get here only once, because we
always handle only one non-multipart MIME part. */
ct = message_decoder_current_content_type(decoder);
if (ct == NULL)
/* text/plain */ ;
else if (mail_html2text_content_type_match(ct)) {
ctx.html2text = mail_html2text_init(MAIL_HTML2TEXT_FLAG_SKIP_QUOTED);
ctx.plain_output = buffer_create_dynamic(pool, 1024);
} else if (strncasecmp(ct, "text/", 5) != 0)
break;
continue;
}
if (!snippet_generate(&ctx, block.data, block.size))
break;
}
i_assert(ret != 0);
message_decoder_deinit(&decoder);
message_parser_deinit(&parser, &parts);
if (ctx.html2text != NULL)
mail_html2text_deinit(&ctx.html2text);
pool_unref(&pool);
return input->stream_errno == 0 ? 0 : -1;
}
开发者ID:nikwrt,项目名称:dovecot-core,代码行数:52,代码来源:message-snippet.c
示例19: index_sort_header_get
int index_sort_header_get(struct mail_search_sort_program *program, uint32_t seq,
enum mail_sort_type sort_type, string_t *dest)
{
struct mail *mail = program->temp_mail;
const char *str;
int ret;
bool reply_or_fw;
index_sort_set_seq(program, mail, seq);
str_truncate(dest, 0);
switch (sort_type & MAIL_SORT_MASK) {
case MAIL_SORT_SUBJECT:
ret = mail_get_first_header(mail, "Subject", &str);
if (ret < 0)
break;
if (ret == 0) {
/* nonexistent header */
return 1;
}
str = imap_get_base_subject_cased(pool_datastack_create(),
str, &reply_or_fw);
str_append(dest, str);
return 1;
case MAIL_SORT_CC:
ret = get_first_mailbox(mail, "Cc", &str);
break;
case MAIL_SORT_FROM:
ret = get_first_mailbox(mail, "From", &str);
break;
case MAIL_SORT_TO:
ret = get_first_mailbox(mail, "To", &str);
break;
case MAIL_SORT_DISPLAYFROM:
ret = get_display_name(mail, "From", &str);
break;
case MAIL_SORT_DISPLAYTO:
ret = get_display_name(mail, "To", &str);
break;
default:
i_unreached();
}
if (ret < 0) {
index_sort_program_set_mail_failed(program, mail);
if (!program->failed)
return 0;
return -1;
}
(void)uni_utf8_to_decomposed_titlecase(str, strlen(str), dest);
return 1;
}
开发者ID:bdraco,项目名称:core,代码行数:52,代码来源:index-sort.c
示例20: checkpassword_child_output
void checkpassword_child_output(struct chkpw_auth_request *request)
{
/* Send: username \0 password \0 timestamp \0.
Must be 512 bytes or less. The "timestamp" parameter is actually
useful only for APOP authentication. We don't support it, so
keep it empty */
struct auth_request *auth_request = request->request;
buffer_t *buf;
const unsigned char *data;
size_t size;
ssize_t ret;
buf = buffer_create_dynamic(pool_datastack_create(), 512+1);
buffer_append(buf, auth_request->user, strlen(auth_request->user)+1);
if (request->password != NULL)
buffer_append(buf, request->password, strlen(request->password)+1);
else
buffer_append_c(buf, '\0');
buffer_append_c(buf, '\0');
data = buffer_get_data(buf, &size);
if (size > 512) {
auth_request_log_error(request->request, "checkpassword",
"output larger than 512 bytes: %"PRIuSIZE_T, size);
request->finish_callback(request,
request->internal_failure_code);
return;
}
ret = write(request->fd_out, data + request->write_pos,
size - request->write_pos);
if (ret <= 0) {
if (ret < 0) {
auth_request_log_error(request->request,
"checkpassword", "write() failed: %m");
}
request->finish_callback(request,
request->internal_failure_code);
return;
}
request->write_pos += ret;
if (request->write_pos < size)
return;
io_remove(&request->io_out);
if (close(request->fd_out) < 0)
i_error("checkpassword: close() failed: %m");
request->fd_out = -1;
}
开发者ID:via,项目名称:dovecot-clouddb,代码行数:51,代码来源:db-checkpassword.c
注:本文中的pool_datastack_create函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论