queue_null.c revision 1.6
1/* $OpenBSD: queue_null.c,v 1.6 2015/01/20 17:37:54 deraadt Exp $ */ 2 3/* 4 * Copyright (c) 2012 Eric Faurot <eric@openbsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19#include <sys/types.h> 20#include <sys/queue.h> 21#include <sys/tree.h> 22#include <sys/socket.h> 23#include <sys/stat.h> 24 25#include <ctype.h> 26#include <err.h> 27#include <errno.h> 28#include <event.h> 29#include <fcntl.h> 30#include <imsg.h> 31#include <inttypes.h> 32#include <libgen.h> 33#include <pwd.h> 34#include <stdio.h> 35#include <stdlib.h> 36#include <string.h> 37#include <time.h> 38#include <unistd.h> 39#include <limits.h> 40 41#include "smtpd.h" 42#include "log.h" 43 44static int 45queue_null_message_create(uint32_t *msgid) 46{ 47 *msgid = queue_generate_msgid(); 48 return (1); 49} 50 51static int 52queue_null_message_commit(uint32_t msgid, const char *path) 53{ 54 return (1); 55} 56 57static int 58queue_null_message_delete(uint32_t msgid) 59{ 60 return (1); 61} 62 63static int 64queue_null_message_fd_r(uint32_t msgid) 65{ 66 return (-1); 67} 68 69static int 70queue_null_message_corrupt(uint32_t msgid) 71{ 72 return (0); 73} 74 75static int 76queue_null_envelope_create(uint32_t msgid, const char *buf, size_t len, 77 uint64_t *evpid) 78{ 79 *evpid = queue_generate_evpid(msgid); 80 return (1); 81} 82 83static int 84queue_null_envelope_delete(uint64_t evpid) 85{ 86 return (1); 87} 88 89static int 90queue_null_envelope_update(uint64_t evpid, const char *buf, size_t len) 91{ 92 return (1); 93} 94 95static int 96queue_null_envelope_load(uint64_t evpid, char *buf, size_t len) 97{ 98 return (0); 99} 100 101static int 102queue_null_envelope_walk(uint64_t *evpid, char *buf, size_t len) 103{ 104 return (-1); 105} 106 107static int 108queue_null_init(struct passwd *pw, int server, const char *conf) 109{ 110 queue_api_on_message_create(queue_null_message_create); 111 queue_api_on_message_commit(queue_null_message_commit); 112 queue_api_on_message_delete(queue_null_message_delete); 113 queue_api_on_message_fd_r(queue_null_message_fd_r); 114 queue_api_on_message_corrupt(queue_null_message_corrupt); 115 queue_api_on_envelope_create(queue_null_envelope_create); 116 queue_api_on_envelope_delete(queue_null_envelope_delete); 117 queue_api_on_envelope_update(queue_null_envelope_update); 118 queue_api_on_envelope_load(queue_null_envelope_load); 119 queue_api_on_envelope_walk(queue_null_envelope_walk); 120 121 return (1); 122} 123 124struct queue_backend queue_backend_null = { 125 queue_null_init, 126}; 127