[Mimedefang] Make problems: libsm + strlcpy

Rick Mallett rmallett at ccs.carleton.ca
Thu Jan 30 13:16:01 EST 2003


One solution is to write your own strlcpy function and add it
to the source for libmilter, or put it in a separate file and
modify the Makefile to compile and link it in. All you need is

size_t strlcpy(char *dst, const char *src, size_t dstsize) {
  if (strlen(src) < dstsize) {
    strcpy(dst,src);
  } else {
    strncpy(dst,src,dstsize-1);
    dst[dstsize-1] = '\0';
  }
  return strlen(src);
}

I didn't test this BTW for syntax errors, but it should work. If
the compiler complains about size_t change it to "int" and it should
work.

- rick

On Thu, 30 Jan 2003, Durand Miller wrote:

>
> Hello,
>
> I'm new here and I've got a problem when I try to make mimedefang.
> Basically, the linker can't find "strlcpy" inside of libmilter or libsm.
> I've done some investigating and strlcpy (or sm_strlcpy) is inside the
> libsm.a file so somewhere its going wrong.
>
> It is a clean sendmail build, following the install steps correctly and
> it's a clean mimedefang build (or attempt thereof) and I followed the
> steps correctly.
>
> I see that this problem has been posted before, about a year ago and no
> answer was given to the user then but I'm hoping someone knows now.
>
> I'm using a clean RedHat 7.3 install.  Basically, I installed RedHat,
> immediately got the new sendmail, built that (went okay) and then tried
> to build mimedefang.
>
> I tried giving correct, qualified paths to the libraries but that didn't
> work.  I tried modifying sendmail source to ensure that the strlcpy
> functions where used (and they were) but with no luck.  I'm a little
> lost.
>
>
> Thanks,
> Durand.
>
>
> Here is my make output:
>
> ------------------------------------------
>
> gcc -g -O2 -Wall -Wstrict-prototypes -pthread -o mimedefang mimedefang.o
> drop_privs_threaded.o utils.o rm_r.o /usr/lib/libmilter.a
> ../sendmail-8.12.7/obj.Linux.2.4.18-3.i686/libsm/libsm.a -lpthread -lnsl
> /usr/lib/libmilter.a(main.o): In function `smfi_register':
> main.o(.text+0x74): undefined reference to `strlcpy'
> /usr/lib/libmilter.a(main.o): In function `smfi_setconn':
> main.o(.text+0x12f): undefined reference to `strlcpy'
> /usr/lib/libmilter.a(listener.o): In function `mi_milteropen':
> listener.o(.text+0x184): undefined reference to `strlcpy'
> /usr/lib/libmilter.a(engine.o): In function `st_connectinfo':
> engine.o(.text+0x83a): undefined reference to `strlcpy'
> collect2: ld returned 1 exit status
> make: *** [mimedefang] Error 1
>
>
>
> _______________________________________________
> MIMEDefang mailing list
> MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
>



More information about the MIMEDefang mailing list