#38 libdkim should avoid using sm_strlcat & sm_strlcpy

v2.7.2
closed-accepted
5
2009-02-18
2008-12-03
No

To build third-party applications with dkim support (from libdkim), you need to use -lsm (sendmails libsm) for sm_strlcat and sm_strlcpy that are used in libdkim.
Then possible, (lib)dkim should utilize the OS native strlcat and strlcpy instead.

Discussion

  • Anonymous - 2008-12-15

    The GNU libc, last I checked, didn't include the strlcat() and strlcpy() functions. It became simpler to include libsm in the distribution and used the clone functions present there.

    It may be possible simply to do this at the top of each libdkim C source file:

    #ifdef WITHOUT_LIBSM
    # define sm_strlcat strlcat
    # define sm_strlcpy strlcpy
    #else /* ... */
    # libsm-stuff-here
    #endif /* ... */

    You'd just have to make sure that the WITHOUT_LIBSM case also ensures the "bool" typedef and "__P" macro definitions are included somehow, and do so in a portable manner. And there may be other issues I haven't thought of yet.

    I don't have the cycles to cover this immediately, but perhaps someone can take a crack at it and contribute a patch if the need is urgent.

     
  • Anonymous - 2008-12-15
    • assigned_to: nobody --> sm-msk
     
  • Anonymous - 2008-12-15
    • milestone: --> 896428
     
  • Anonymous - 2009-01-20
    • milestone: 896428 --> v2.7.2
    • labels: 740972 -->
     
  • Anonymous - 2009-01-20

    Try the attached patch, and make the corresponding change to your site.config.m4.
    File Added: PATCH

     
  • Anonymous - 2009-01-20

    Proposed patch #1

     
  • Anonymous - 2009-01-20
    • labels: --> Feature Request
     
  • Fredrik Pettai

    Fredrik Pettai - 2009-02-06

    Thx,
    The patch applies well and I compiles under NetBSD 5.0_RC1.
    Now it just has to run some time to verify that is works as expected...

     
  • Fredrik Pettai

    Fredrik Pettai - 2009-02-06

    Thx,
    The patch applies well on dkim-milter-2.8.1 and I compiles under NetBSD 5.0_RC1.
    Now it just has to run some time to verify that is works as expected...

     
  • Fredrik Pettai

    Fredrik Pettai - 2009-02-06

    Addon to patch #2

     
  • Fredrik Pettai

    Fredrik Pettai - 2009-02-06

    I patched some more files (see PATCH2) and after that all references to sm_strlcat() & sm_strlcpy() gone.
    But now I get some new warnings as well.

    File Added: PATCH2

     
  • Anonymous - 2009-02-06

    I'm not clear on why those changes are needed. libdkim doesn't contain the files you included in your patch (one was in libar, the others were test binaries), so it shouldn't include any more references to the sm_strl*() functions.

    I just tried the patch on Linux, FreeBSD and Solaris 9, and none of them produced a library with any references to the sm_strl*() functions.

     
  • Anonymous - 2009-02-07

    The proposed patch, plus part of the submitted patch (the libar/ar.c part), will be included as part of 2.8.2 which will come out later this month.

     
  • Anonymous - 2009-02-18
    • status: open --> closed-accepted
     
  • Anonymous - 2009-02-18

    Patch to make this optional at compile time (-DWITHOUT_LIBSM) available in v2.8.2, now released.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks