Re: [exim] Returning static strings from dlfunc?

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Phil Pennock
Dátum:  
Címzett: Janne Snabb
CC: exim-users
Tárgy: Re: [exim] Returning static strings from dlfunc?
On 2012-05-07 at 18:57 +0700, Janne Snabb wrote:
> 2012-05-07 11:33:12 [7246] POOL_PERM = 1, POOL_MAIN = 0, store_pool = 0,
> arg = conn
> 2012-05-07 11:33:14 [7246] 1SRMBm-0001ss-1w POOL_PERM = 1, POOL_MAIN =
> 0, store_pool = 0, arg = data
>
> Thus looks like "store_pool" is 0 (POOL_MAIN) in both cases. Exim is not
> automatically switching the pool when I set acl_c_* variable from SMTP
> connect ACL.
>
> Or maybe I am missing something? I am not referring to acl_c_foobar or
> acl_m_foobar anywhere after setting them. I am assuming that Exim does
> not realize this and does not optimize it on its own.


src/acl.c :

----------------------------8< cut here >8------------------------------
    /* Connection variables must persist forever */


    case ACLC_SET:
      {
      int old_pool = store_pool;
      if (cb->u.varname[0] == 'c') store_pool = POOL_PERM;
      acl_var_create(cb->u.varname)->data.ptr = string_copy(arg);
      store_pool = old_pool;
      }
    break;
----------------------------8< cut here >8------------------------------


So for simple assignment to ACL variables, returning a const string
wouldn't matter, but you don't know that your return result won't be
part of a longer expansion string, doing something else, perhaps even
being passed to another dlfunc doing something else strange.

So I'd continue to return in POOL_MAIN and let it be copied to
POOL_PERM.

> > It's possible that the default pool should change for some ACLs, but I
> > don't have enough context to know what problem you're encountering.
>
> Looks like this is not happening.


Sorry, the "should change" was meant as "we should change it so that it
changes for some ACLs".

-Phil