Page MenuHome GnuPG

libassuan: uses of socklen_t in assuan.h are inconsistent
Open, WishlistPublic

Description

In assuan.h (the exposed API), there are uses of socklen_t and no-uses.

  • In some platform, socklen_t is not defined.
    • For the build of libassuan, it is properly addressed by configure, and config.h defines the result.
    • but the result is not exported to assuan.h
  • The API for assuan_sock_connect, assuan_sock_bind and assuan_sock_nonce should use socklen_t.
    • Other parts, connect method in struct assuan_system_hooks, __assuan_connect, and _assuan_npth_connect are using socklen_t

Event Timeline

gniibe triaged this task as Wishlist priority.Apr 8 2022, 3:38 AM
gniibe created this task.

I think that good approach as of 2022 is:

  • Don't support platform with no socklen_t any more
    • (On such a platform, using assuan.h has been requiring defining socklen_t before the inclusion of assuhan.h)
    • assuming socklen_t is always available
    • Thus, remove configure's checking of socklen_t
  • Use socklen_t for assuan.h properly
    • connect method in struct assuan_system_hooks
    • __assuan_connect
    • _assuan_npth_connect
    • This won't constitute API/ABI break on normal platforms with socklen_t == int
    • This will be API break on 32-bit platforms with socklen_t = some other 32-bit type, but not ABI break. (Are there any?)
    • This will be ABI break on platform where sizeof(socklen_t) != sizeof(int) (not likely, any)