Issue 8235 - compiler warnings in smbk5pwd.c with nettle
Summary: compiler warnings in smbk5pwd.c with nettle
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: contrib (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-02 20:14 UTC by Ryan Tandy
Modified: 2015-11-30 18:20 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Ryan Tandy 2015-09-02 20:14:48 UTC
Full_Name: Ryan Tandy
Version: master
OS: Debian
URL: 
Submission from: (NULL) (24.68.37.4)
Submitted by: ryan


smbk5pwd.c: In function 'lmhash':
smbk5pwd.c:206:21: warning: passing argument 2 of 'nettle_des_set_key' from
incompatible pointer type [-Wincompatible-pointer-types]
  des_set_key( &ctx, &key );
                     ^
AIAIn file included from smbk5pwd.c:69:0:
/usr/include/nettle/des.h:76:1: note: expected 'const uint8_t * {aka const
unsigned char *}' but argument is of type 'unsigned char (*)[8]'
 des_set_key(struct des_ctx *ctx, const uint8_t *key);
 ^
(and several more)

The openssl and gcrypt versions both used "&key" as well. It's correct for
openssl, which takes a DES_cblock *. It's ambiguous for gcrypt, which takes a
void *. It's wrong for nettle, which expects an unsigned char *.

This is not a functional problem, since in all cases the pointer points at the
beginning of the array. Fixing the warning does not change the output.

smbk5pwd.c: In function 'nthash':
smbk5pwd.c:249:36: warning: pointer targets in passing argument 3 of
'nettle_md4_update' differ in signedness [-Wpointer-sign]
  md4_update( &ctx, passwd->bv_len, passwd->bv_val );
                                    ^
In file included from smbk5pwd.c:70:0:
/usr/include/nettle/md4.h:69:1: note: expected 'const uint8_t * {aka const
unsigned char *}' but argument is of type 'char *'
 md4_update(struct md4_ctx *ctx,
 ^

openssl and gcrypt both use void * here, nettle needs a cast (which should be
safe).

The remaining warnings are not nettle-specific.

smbk5pwd.c: In function 'smbk5pwd_cf_func':
smbk5pwd.c:915:14: warning: variable 'db' set but not used
[-Wunused-but-set-variable]
    BackendDB db = *c->be;
              ^

Added in 29fab9c, apparently never used. Looks like cruft to me. Most likely
didn't generate a warning with gcc prior to 4.6, due to the assignment just
below.

smbk5pwd.c: In function 'smbk5pwd_modules_init':
smbk5pwd.c:968:2: warning: variable 'dummy_ad' set but not used
[-Wunused-but-set-variable]
  dummy_ad;
  ^

The unused-but-set-variable warning is new in gcc 4.6 and there is a different
no-op trick to suppress it in a portable way.
Comment 1 Ryan Tandy 2015-09-02 20:18:42 UTC
changed notes
changed state Open to Test
moved from Incoming to Contrib
Comment 2 Quanah Gibson-Mount 2015-09-11 17:02:30 UTC
changed notes
changed state Test to Release
Comment 3 Quanah Gibson-Mount 2015-09-11 17:04:14 UTC
changed notes
Comment 4 OpenLDAP project 2015-11-30 18:20:24 UTC
fixed in master
fixed in RE25
fixed in RE24
Comment 5 Quanah Gibson-Mount 2015-11-30 18:20:24 UTC
changed notes
changed state Release to Closed