You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by so...@apache.org on 2005/09/17 22:23:16 UTC

svn commit: r289846 - in /httpd/mod_smtpd/trunk/modules/misc/mod_smtpd_rcpt_ok: ./ mod_smtpd_rcpt_ok.c

Author: soc-rian
Date: Sat Sep 17 13:23:13 2005
New Revision: 289846

URL: http://svn.apache.org/viewcvs?rev=289846&view=rev
Log:
initial rcpt_ok module commit

Added:
    httpd/mod_smtpd/trunk/modules/misc/mod_smtpd_rcpt_ok/
    httpd/mod_smtpd/trunk/modules/misc/mod_smtpd_rcpt_ok/mod_smtpd_rcpt_ok.c

Added: httpd/mod_smtpd/trunk/modules/misc/mod_smtpd_rcpt_ok/mod_smtpd_rcpt_ok.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/modules/misc/mod_smtpd_rcpt_ok/mod_smtpd_rcpt_ok.c?rev=289846&view=auto
==============================================================================
--- httpd/mod_smtpd/trunk/modules/misc/mod_smtpd_rcpt_ok/mod_smtpd_rcpt_ok.c (added)
+++ httpd/mod_smtpd/trunk/modules/misc/mod_smtpd_rcpt_ok/mod_smtpd_rcpt_ok.c Sat Sep 17 13:23:13 2005
@@ -0,0 +1,63 @@
+#include "httpd.h"
+#include "http_config.h"
+
+#include "mod_smtpd.h"
+
+typedef struct rcpt_ok_config {
+    int bEnabled;
+} rcpt_ok_config;
+
+module AP_MODULE_DECLARE_DATA smtpd_rcpt_ok_module;
+
+static smtpd_retcode default_rcpt(smtpd_conn_rec *scr, smtpd_return_data *out,
+                                  char *address)
+{
+    rcpt_ok_config *pConfig =
+      ap_get_module_config(scr->s->module_config,
+                           &smtpd_rcpt_ok_module);
+
+    return (pConfig->bEnabled) ? SMTPD_OK : SMTPD_DECLINED;
+}
+
+static void *create_config(apr_pool_t *p, server_rec *s) {
+    rcpt_ok_config *pConfig = apr_pcalloc(p, sizeof(*pConfig));
+    
+    pConfig->bEnabled = 0;
+    return pConfig;
+}
+
+static const char *set_module_status(cmd_parms *cmd, void *struct_ptr,
+                                       int arg)
+{
+    rcpt_ok_config *pConfig =
+      ap_get_module_config(cmd->server->module_config,
+                           &smtpd_rcpt_ok_module);
+
+    pConfig->bEnabled = arg ? 1 : 0;
+
+    return NULL;
+}
+
+static const command_rec rcpt_ok_cmds[] = {
+    AP_INIT_FLAG("SmtpRcptOk", set_module_status, NULL,  RSRC_CONF,
+                 "Whether we are allowing all rcpts or not."
+                 "Default: Off"),
+
+    { NULL }
+};
+
+// registers httpd hooks
+static void register_hooks (apr_pool_t *p)
+{
+  APR_OPTIONAL_HOOK(smtpd, rcpt, default_rcpt, NULL, NULL, APR_HOOK_LAST);
+}
+
+module AP_MODULE_DECLARE_DATA smtpd_rcpt_ok_module = {
+  STANDARD20_MODULE_STUFF,
+  NULL,                       // create per-directory config structure
+  NULL,                       // merge per-directory config structures
+  create_config,
+  NULL,                       // merge per-server config structures 
+  rcpt_ok_cmds,
+  register_hooks              // register hooks
+};