Re: cvm-vmailmgr lookup problem (internal temporary error)
Dale Woolridge <[email protected]> Sun, 25 Sep 2005 23:20:48 -0400
| Newsgroups | gmane.comp.sysutils.bgware |
|---|---|
| Message-ID | <[email protected]> |
On 15-Sep-2005 12:09 Mattias Wikstrom wrote:
|
| I tested it. It compiled without problems but it isn't passing the
| rcpt-info past cvm-vmailmgr:
Try the attached patch instead. Thanks.
--
-dale
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
patch-cvm-0.76-sg.dw.chainok.1-freebsd
(text/plain, 2.2 KB)
Index: vmlookup.c
===================================================================
--- vmlookup.c (revision 406)
+++ vmlookup.c (working copy)
@@ -73,14 +73,16 @@
case -1: return CVME_IO;
case 0: return CVME_PERMFAIL;
}
- if (virtuser.len == 0)
- return CVME_PERMFAIL;
+ if (virtuser.len == 0) return CVME_PERMFAIL | CVME_CHAIN_OK;
memset(&cdb, 0, sizeof cdb);
str_lower(&virtuser);
/* Found a virtual user, authenticate it. */
if (chdir(vmuser.homedir.s) == -1) return CVME_IO;
- if ((fd = open(pwfile, O_RDONLY)) == -1) return CVME_IO;
+ if ((fd = open(pwfile, O_RDONLY)) == -1) {
+ if (errno == ENOENT) return CVME_IO | CVME_CHAIN_OK;
+ return CVME_IO;
+ }
cdb_init(&cdb, fd);
switch (cdb_get(&cdb, &virtuser, &vpwdata)) {
case -1:
Index: errors.h
===================================================================
--- errors.h (revision 406)
+++ errors.h (working copy)
@@ -14,6 +14,11 @@
is fatal and should cause module shutdown. */
#define CVME_FATAL 0x100
+/* This is for chaining. Modules can return errors, but ones
+ that are masked with this flag indicate it's okay to pass
+ along to next chain entry */
+#define CVME_CHAIN_OK 0x200
+
#define CVME_MASK 0x0ff
extern const char* const cvm_errlist[];
Index: cvm-chain.c
===================================================================
--- cvm-chain.c (revision 406)
+++ cvm-chain.c (working copy)
@@ -12,6 +12,7 @@
const char* chains[10];
int chain_count;
+int chain_weak = 0;
static void cvm_chain_init()
{
@@ -33,6 +34,8 @@
int i;
char varname[] = "CVM_CHAIN#";
+ chain_weak = !!getenv("CVM_CHAIN_WEAK");
+
chain_count = 0;
for (i = 0; i <= 9; ++i) {
varname[9] = i + '0';
@@ -48,6 +51,7 @@
int cvm_module_lookup(void)
{
+#define CHAIN_BROKEN(c) (chain_weak?(((c) & CVME_CHAIN_OK) == 0):(((c) & CVME_FATAL) != 0))
int i;
int credcount;
int code;
@@ -61,11 +65,11 @@
}
}
- for (code = i = 0; i < chain_count && ((code & CVME_FATAL) == 0); i++) {
+ for (code = i = 0; i < chain_count; i++) {
cvm_chain_init();
code = cvm_client_authenticate(chains[i], credcount, creds);
- if (code == 0)
- return 0;
+ if (code == 0) return 0;
+ if (CHAIN_BROKEN(code)) break;
}
return code;
}